<?php

namespace application\Module;

use library\Core\Db\CDbCriteria;
use application\Model\ArticleModel;

class Article
{

    public function getList($pid, $select = ['id', 'name', 'description', 'url', 'content', 'create_time'])
    {
        $criteria = new CDbCriteria();
        $criteria->select($select);
        $criteria->addEqCondition('category_id', $pid);
        $criteria->addEqCondition('is_del', 0);
        $criteria->addEqCondition('status', 1);
        $criteria->addOrderDesc('orderby');
        $articleModel = new ArticleModel();
        return $data = $articleModel->getListForArray($criteria);
    }

}
